#include "BondDetailPrcInstitute.h"
#include "BondDetailData.h"
#include "../QbMessageProcess.h"
#include <QVBoxLayout>
#include <QTableWidget>
#include <qbkernel/include/qb_base.h>
#include <core/StyleMgr.h>
#include <core/ImageMgr.h>
#include <QLabel>
#include <QPixmap>
#include <QEvent>
#include <QStylePainter>
#include <widgets/SImageButton.h>
#include <uam/UserAccountManager.h>

// 申购机构
BondDetailPrcInstitute::BondDetailPrcInstitute(QWidget* p, QSharedPointer<DetailData> data)
	: QWidget(p), m_data(data)
{
	setFixedHeight(155);
	QHBoxLayout* h = new QHBoxLayout(this);
	h->setContentsMargins(0, 22, 2, 0);
	m_grid = new QGridLayout();
	m_grid->setSpacing(20);
	m_grid->setVerticalSpacing(5);
	h->addLayout(m_grid);
}

void BondDetailPrcInstitute::getBondInfo()
{
	m_strCombKey = m_data->bond().GetCombBondKey();
	m_bValidInfo = CBondContainer::instance().GetBondInfoByCombKey(m_strCombKey, &m_bondInfo);
}

void BondDetailPrcInstitute::getUnderwriterImage(QString allowId)
{
	if (allowId.isEmpty())
		return;

	//TODO:加载图片
	
}

void BondDetailPrcInstitute::setBondInfo(QSharedPointer<DetailData> data)
{
	QB_CHECK_RETURN_VOID1(data);
	m_data = data;
	refreshData();
}

void BondDetailPrcInstitute::refreshData()
{
	getBondInfo();
}
